#include<iostream>
#include<fstream>
using namespace std;
const int LEN = 256;
bool process_arithmetic(char * in_str, char * out_str);
int get_carrys(int lh, int rh);
int main(int argc, char * argv[])
{
    char in_str[LEN] = "in.txt";
    char out_str[LEN] = "out.txt";
    process_arithmetic(in_str, out_str);
    return 0;
}

int get_carrys(int lh, int rh)
{
    int carrys = 0;
    int cache = 0;
    while(lh != 0 && rh != 0)
    {
        int b_l = lh % 10;
        int b_r = rh % 10;
        cache = (b_l + b_r + cache)/10;
        carrys += cache;
        lh /= 10;
        rh /= 10;
    }
    return carrys;
}

bool process_arithmetic(char * in_str, char * out_str)
{
    ifstream fin(in_str, ios::in);
    ofstream fout(out_str, ios::out);
    if(!fin || !fout)
        return false;
    int lh = 0, rh = 0;
    fin >> lh >> rh;
    while(lh!=0 && rh!=0)
    {
        fout << get_carrys(lh, rh) << endl;
        fin >> lh >> rh;
    }
    fin.close();
    fout.close();
    return true;
}
